package com.xnyzc.lhy.common.penum.wallet;

/**
 * @Description 交易类型(0余额充值、1余额支出、2支付宝充值、3支付宝支出、4微信充值、5微信支出、6公务额度收入、7公务额度支出、8个人额度收入、9个人额度支出)
 * @Author zhuyubin
 * @Date 2019/7/30 17:55
 **/
public enum  ERecordType {

    moneyTopUp(0,"余额充值", 0, "充值"),
    moneyDisbursement(1, "余额支出", 1, "支出"),
    alipayTopUp(2, "支付宝充值", 0, "充值"),
    alipayDisbursement(3, "支付宝支出", 1, "支出"),
    weChatTopUp(4, "微信充值", 0, "充值"),
    weChatDisbursement(5, "微信支出", 1, "支出"),
    officialTopUp(6, "公务额度收入", 0, "充值"),
    officialDisbursement(7, "公务额度支出", 1, "支出"),
    myTopUp(8, "个人额度收入", 0, "充值"),
    myDisbursement(9, "个人额度支出", 1, "支出"),
    compensation(10, "司机补偿", 0, "充值"),
    fine(11, "司机罚款", 1, "支出"),
    reward(12, "活动奖励", 0, "充值"),
    withdrawal(13, "发起提现", 1, "支出"),
    changePrice(14, "改价平账", 0, "充值"),
    refund(15, "退款平账", 1, "支出"),
    withdrawalBack(16, "提现退回", 0, "充值");

    private Integer type;
    private String value;
    private Integer recordType;
    private String desc;


    ERecordType(Integer type, String value, Integer recordType, String desc){
        this.type = type;
        this.value = value;
        this.recordType = recordType;
        this.desc = desc;
    }

    public static ERecordType findById(Integer type){
        ERecordType eRecordType;
        switch (type){
            case 0:
                eRecordType  = ERecordType.moneyTopUp;
                break;
            case 1:
                eRecordType = ERecordType.moneyDisbursement;
                break;
            case 2:
                eRecordType = ERecordType.alipayTopUp;
                break;
            case 3:
                eRecordType = ERecordType.alipayDisbursement;
                break;
            case 4:
                eRecordType = ERecordType.weChatTopUp;
                break;
            case 5:
                eRecordType = ERecordType.weChatDisbursement;
                break;
            case 6:
                eRecordType = ERecordType.officialTopUp;
                break;
            case 7:
                eRecordType = ERecordType.officialDisbursement;
                break;
            case 8:
                eRecordType = ERecordType.myTopUp;
                break;
            case 9:
                eRecordType = ERecordType.myDisbursement;
                break;
            case 10:
                eRecordType = ERecordType.compensation;
                break;
            case 11:
                eRecordType = ERecordType.fine;
                break;
            case 12:
                eRecordType = ERecordType.reward;
                break;
            case 13:
                eRecordType = ERecordType.withdrawal;
                break;
            case 14:
                eRecordType = ERecordType.changePrice;
                break;
            case 15:
                eRecordType = ERecordType.refund;
                break;
            case 16:
                eRecordType = ERecordType.withdrawalBack;
                break;
            default:
                throw new IllegalArgumentException("非法type");
        }
        return eRecordType;
    }

    public String getValue(){
        return this.value;
    }

    public Integer getType(){
        return this.type;
    }

    public String getDesc(){
        return this.desc;
    }

    public Integer getRecordType(){
        return this.recordType;
    }
}
